<?php
namespace Admin\Controller;
use Think\Controller;
class ChackController extends Controller {
   public function _initialize()  
    {  
        header("Content-Type: text/html; charset=utf-8");

        if(!session('user')){
            $message=D('User')->loginout(2);
            $this->success($message,U('index/index'));die;
        }
    } 
	/**
    *删除列表处理
    */
    public function text(){
        $db_data=M('user');
        if($_POST){
            if($_POST['message']=='del'){
                $del=$_POST['id_arr'];
                foreach ($_POST['id_arr'] as $key => $value) {
                    $del_arr=$value.$del_arr;
                    if($_POST['id_arr'][$key+1]){
                        $del_arr=','.$del_arr;
                    }
                }
                $res=$db_data->delete($del_arr);
                if($res){
                    $this->success('删除成功',U('admin_user'),1);
                }
                else{
                    $this->error('删除失败',U('admin_user'),1);
                }
            }
        }
        else{
            if(!$_GET['p'])$_get['p']=1;
            $count      = $db_data->count();
            $Page       = new \Think\Page($count,10);
            $show       = $Page->show();
            $list = $db_data->limit($Page->firstRow.','.$Page->listRows)->select();
            $this->assign('count',$count);
            $this->assign('list',$list);
            $this->assign('page',$show);
            $this->display();
        }
    }
    
    public function ajax_get_table(){
        echo 123;
        $where['web_id']=51;
             $m=M('web_user')->where($where)->find();
             dump($m);
    }
}